package com.youtui.common.util;

import static org.junit.Assert.fail;

import java.io.UnsupportedEncodingException;

import org.apache.commons.codec.binary.Hex;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/** spring junit */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:spring/spring-*.xml")
public class DxSmsUtilTest {

	@Autowired HttpClientUtil httpclient;
	
	@Test
	public void test() throws Exception {
		String mobile ="18767122705";
		String username="100244";
		String password="asd0112";
		int dateCoding =8;
		
		String message ="【明楚科技】您的登录验证码为：1234,有效期10分钟， 欢迎使用优推互动广告平台！";
		String hex = Hex.encodeHexString(message.getBytes("UTF-16BE"));
		
		StringBuilder sb= new StringBuilder();
		sb.append("http://61.129.57.233:7891/mt?")
		.append("un=").append(username)
		.append("&pw=").append(password) 
		.append("&da=").append(mobile)  
		.append("&dc=").append(dateCoding) 
		.append("&sm=").append(hex); 
		System.out.println(sb.toString());
		String result = httpclient.doGet(sb.toString());
		System.out.println(result);
	}

}
